import pymysql
from pymysql import cursors
from dbutils.pooled_db import PooledDB
from SETTINGS import *


def get_db_pool():
    """
    mysql链接池
    """
    return PooledDB(
        creator=pymysql,
        maxconnections=10,
        host=MYSQL_HOST,
        port=MYSQL_PORT,
        user=MYSQL_USER,
        password=MYSQL_PASSWORD,
        db=MYSQL_DBNAME,
        charset='utf8mb4',
        cursorclass=cursors.DictCursor
    )
